package com.bw.home.widget;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

/**
 * @author:created by hahajing
 * 时间：2024/5/7 0007
 * 企鹅号:444511958
 * 描述:
 */
public class IVideoRecyclerView extends RecyclerView {
    public IVideoRecyclerView(@NonNull Context context) {
        super(context);
    }

    public IVideoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public IVideoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

//    @Override
//    public boolean onInterceptTouchEvent(MotionEvent e) {
//
//        int count = getChildCount();
//        for (int i=0;i<count;i++){
//            View view = getChildAt(i);
//            if (view instanceof RecyclerView){
//                Rect rect =  view.getClipBounds();
//                float x= e.getX();
//                e.getRawX();
//                float y =  e.getY();
//                e.getRawY();
//                if (rect.contains((int)x,(int)y)){
//                    return false;
//                }
//            }
//        }
//        return true;
//    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()){
            case MotionEvent.ACTION_DOWN:
//                ev.getX();
//                ev.getY();
                super.requestDisallowInterceptTouchEvent(true);
                break;
        }

        return super.dispatchTouchEvent(ev);

    }
}
